//
//  UIBarButton+Extension.swift
//  weibo
//
//  Created by user on 15/11/27.
//  Copyright © 2015年 user. All rights reserved.
//

import UIKit


extension UIBarButtonItem {
    convenience init(imageName: String) {
        let button = UIButton()
        
        button.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "\(imageName)_highlighted"), forState: UIControlState.Highlighted)
        
        button.sizeToFit()
        
        //需要调用本类的指定构造函数
        self.init(customView: button)
        
    }
}
